package model

import (
	"time"
)

type Model struct {
	Id        int64     `json:"id" xorm:"pk autoincr"`
	CreatedAt time.Time `json:"created_at" xorm:"created"`
	UpdatedAt time.Time `json:"updated_at" xorm:"updated"`
	DeletedAt time.Time `json:"deleted_at"`
}

type Pagination struct {
	Page     int `json:"page" url:"page" default:"1"`
	PageSize int `json:"page_size" url:"page_size" default:"20"`
}

func (r *Pagination) Offset() int {
	return (r.Page - 1) * r.PageSize
}
func (r *Pagination) Limit() int {
	return r.PageSize
}

type Sorting struct {
	Order          string `json:"order" url:"order" default:"id"`
	OrderDirection bool   `json:"order_direction" url:"order_direction" default:"true"`
}
